<?php

namespace app\common\validate;

class StaffValidate extends BaseValidate
{
    /**
     * 验证规则
     */
    protected $field = [
        'username'   => '员工名称',
        'staff_type' => '员工类型',
        'head_pic'   => '店长头像',
        'labels'     => '技能标签',
        'stores'     => '管辖门店',
        'sex'        => '性别',
        'mobile'     => '手机号',
        'user_code'  => '登录工号',
        'password'   => '登录密码',
    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'index'  => [],
        'save'   => [
            "username"   => "require|unique:staff",
            "staff_type" => 'require|in:1,2,3',
            "head_pic"   => "require",
            "staff_tag"  => "arrayHasOnlyInts",
            "stores"     => "array",
            "sex"        => 'require|in:1,2',
            "mobile"     => "require|mobile|unique:staff",
            "user_code"  => "require|unique:staff",
            "password"   => "require|alphaDash|min:6",
        ],
        'update' => [
            'id'         => 'require',
            "username"   => "unique:staff",
            "staff_type" => 'in:1,2,3',
            "staff_store" => 'arrayHasOnlyInts',
            "head_pic"   => "require",
            "labels"     => "array",
            "sex"        => 'in:1,2',
            "mobile"     => "mobile|unique:staff",
            "user_code"  => "unique:staff",
            "staff_tag"  => "arrayHasOnlyInts"
        ],
        'delete' => [],
        'read'   => [],
        'setPassword' =>[
            'id'         => 'require',
            "password"   => "alphaDash|min:6",
        ]
    ];

    /**
     * 提示消息
     */
    protected $message = [

    ];


}
